UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WjuY51d2Ca2I5ddBdPQiQ4JHPz6r1OP7a2+nzItZl0Q=' 
WHERE 
  key_id = 'c3b60ffaa0da1f9f72024c09e126fb4ba056e52c1d927ae45852402447600409' 
  AND (
    token = 'WjuY51d2Ca2I5ddBdPQiQ4JHPz6r1OP7a2+nzItZl0Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032