UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yhky3n6DpJAL+idUr0ksu2GqiFKr+M4t6q6onC+iry4=' 
WHERE 
  key_id = '8980d1edbb873e630c9fc4a72235d758dc245da94682e7c2dcbe1298547f8be5' 
  AND (
    token = 'yhky3n6DpJAL+idUr0ksu2GqiFKr+M4t6q6onC+iry4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026