UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q+z0sOyaRn1fTdWPqbezc2aDvCwQl/Z5x19XZ9JOoA8='
WHERE
key_id = 'c2850d645464d6e3ca29d412fb48f81874ff0ed59b3355f47b58a81ff3bf21db'
AND (
token = 'q+z0sOyaRn1fTdWPqbezc2aDvCwQl/Z5x19XZ9JOoA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)