UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lQ3OHFXgg/IsTtxiPEK8kNN1zL0RrO+gZ33N01HTCgc=' 
WHERE 
  key_id = '2ef0a918321463a2d7ae48c01ada4232be1920b6a19b2af1e3f620aa0d7fb540' 
  AND (
    token = 'lQ3OHFXgg/IsTtxiPEK8kNN1zL0RrO+gZ33N01HTCgc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019