UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p4wfigJLQwj2ByJWSqb8dDNeCFHLdk/nHW3o/yikPcA='
WHERE
key_id = '082df7d2fb53b24a41b39fcc5f8d8c5571a1491d24f79733d4accdbe236e9558'
AND (
token = 'p4wfigJLQwj2ByJWSqb8dDNeCFHLdk/nHW3o/yikPcA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)