UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bG5U39tW1tjTBVXzq8ELCGsH9gcQYNaO9Xiigiy+fQw='
WHERE
key_id = '9b069aa2eb10ed6eea37e487f99a99c737849dae0df73b3064a8ee39358c2b6f'
AND (
token = 'bG5U39tW1tjTBVXzq8ELCGsH9gcQYNaO9Xiigiy+fQw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)