UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OtnUcDc1gu6+8xsmnz8xUWzWUYDgvZzVb/1Gzr0CCOA=' 
WHERE 
  key_id = '9f2b5f6774a4710cc60c31037881f359d75ef568264df7007042dee5c4584109' 
  AND (
    token = 'OtnUcDc1gu6+8xsmnz8xUWzWUYDgvZzVb/1Gzr0CCOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026