UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oL23xAwOofKeRvtmoO90u6Rm7vDI3E+1OyKl+bTNEX8='
WHERE
key_id = 'cc3ee523cb0479a1035757e9cd0b8ab5247ad75373e9c5e4b17231a492efe993'
AND (
token = 'oL23xAwOofKeRvtmoO90u6Rm7vDI3E+1OyKl+bTNEX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)