UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RtqYj5Rjuo+nmBz0wc3y/cNyXwRMDKeKErdG+c3yF1E='
WHERE
key_id = '840e426a2a42c586aa45e763be542d4e3bbb857a748fd574bc52c6e21b4a056e'
AND (
token = 'RtqYj5Rjuo+nmBz0wc3y/cNyXwRMDKeKErdG+c3yF1E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)