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

Query time 0.00039