UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8tOPoPBBI4xM625FTeVAnYCxpJ8DYn5w1i0Ueryd8I8='
WHERE
key_id = 'cd84be89fd9035031073a582cafd86e9b2b1818c805a4131c13b851dd722efee'
AND (
token = '8tOPoPBBI4xM625FTeVAnYCxpJ8DYn5w1i0Ueryd8I8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)