UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gUw2AZiFnxSvQVyfGkkdNygeoyo/uv4AX1tSB4eDy2k='
WHERE
key_id = 'a521cdb5247c8976e8b1947a8d811161b35344f3473c1ee8eb205dde38d88971'
AND (
token = 'gUw2AZiFnxSvQVyfGkkdNygeoyo/uv4AX1tSB4eDy2k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)