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