UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bPH9pP6WQly/so4VMVHiHUVXXC5etq33jqEjJiVnz2I=' 
WHERE 
  key_id = '7fb80511928a147347388b112f9f366e316695f611baeb26b4e07d5d34045383' 
  AND (
    token = 'bPH9pP6WQly/so4VMVHiHUVXXC5etq33jqEjJiVnz2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042