UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RpJSZVvsqZIR7kdBTLwWWvDC9n1uAFoP4wXovk9NDG0='
WHERE
key_id = 'b00e9837f34667d645c2c0977d306c5d75c221af8dcd8d3eb89625d618924aa5'
AND (
token = 'RpJSZVvsqZIR7kdBTLwWWvDC9n1uAFoP4wXovk9NDG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)