UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cupdaW9vSBPo8yNrFRlNdrs834bPehH7jfXGoN8VuEU='
WHERE
key_id = '36c7968081d89e2966d002c09ccbe62b4316e3249cad42346c41752d764f27a5'
AND (
token = 'cupdaW9vSBPo8yNrFRlNdrs834bPehH7jfXGoN8VuEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)