UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UB1PgIg0pI6CGwndmawp1xlBRyX+w80FP3nhR/pRDho=' 
WHERE 
  key_id = 'af40a01686c728395d5944d2c858002a0ea37056d6748ba5d0c70be33fe72cec' 
  AND (
    token = 'UB1PgIg0pI6CGwndmawp1xlBRyX+w80FP3nhR/pRDho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036