UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iYtZCJTiOcgL4glzhkiSZT8NxayoGsDjk/+1h/N6hTw='
WHERE
key_id = '3ed406fe3c6dd8584063ed04f79407f7af1613e93a2a351a60c30c175da63aa3'
AND (
token = 'iYtZCJTiOcgL4glzhkiSZT8NxayoGsDjk/+1h/N6hTw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)