UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sK48ZCvakiWN3HbSDQnBIfNIlPUNxxRpYRh7w1t+GCk=' 
WHERE 
  key_id = 'b9af2a2d584174c89a5940b2a1137ceef21877c4ece96ea351d00acb8cecbcd3' 
  AND (
    token = 'sK48ZCvakiWN3HbSDQnBIfNIlPUNxxRpYRh7w1t+GCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041