UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uHT9Ep4QZGqGrfkKDFvayjXt3XHyqfkT0arc2sKp5r8='
WHERE
key_id = '5b651b7c3f2c92797e83cff72bd0c6315d7af7234f5c498945a64e3387204e26'
AND (
token = 'uHT9Ep4QZGqGrfkKDFvayjXt3XHyqfkT0arc2sKp5r8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)