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