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

Query time 0.00056