UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UoBQ/kcDW9X/xm7NYkE0i7pOaCpVoAvAOxK4rdcL0Y8='
WHERE
key_id = '6aa7187ba765a56af2b9398af7d9f2bd490be560f9b18ba46569f1bfdceff38c'
AND (
token = 'UoBQ/kcDW9X/xm7NYkE0i7pOaCpVoAvAOxK4rdcL0Y8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)