UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ts9Y7oPcDdWeEvdCJHxfFNhY+SbxPs7+KiMkeIUF53U='
WHERE
key_id = '20d1042c25be067997bef4f8c314481a5db964e609e75a27d10fcc5f6e46438e'
AND (
token = 'Ts9Y7oPcDdWeEvdCJHxfFNhY+SbxPs7+KiMkeIUF53U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)