UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ri4H25h9cVaDow9RHd4Hoz3wlqNBBsejnsqvm7/KYsM='
WHERE
key_id = '28ae40d09633ec04643cdb20aa64aa257be61f23c70b1528ce104071035825bb'
AND (
token = 'ri4H25h9cVaDow9RHd4Hoz3wlqNBBsejnsqvm7/KYsM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)