UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e7G2/AO98Vkva3sUaKKfACyzMuYWw41+gYvFVRJ+uYo=' 
WHERE 
  key_id = '98eefaf7d5ab7bd069912dc1f558a25ce239bd409283f0f50b523307f8927590' 
  AND (
    token = 'e7G2/AO98Vkva3sUaKKfACyzMuYWw41+gYvFVRJ+uYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039