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

Query time 0.00030