UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PN4TrjNanQ2g/gfVc08cIwh+erN9BOJjUq8Q6l+Is+Q=' 
WHERE 
  key_id = 'e2477588575814e6cb825a8929857a1a273ffa6d6a34e390535ac861b014d278' 
  AND (
    token = 'PN4TrjNanQ2g/gfVc08cIwh+erN9BOJjUq8Q6l+Is+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021