UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7hU6X5ZtpygbaRR5rI2F7mDrY0xSJUhTsg9yfU1XYQY=' 
WHERE 
  key_id = '6e0d8ff6f837c52cda51f0a628c2b77d860637643ce14e514c9783cc516210a7' 
  AND (
    token = '7hU6X5ZtpygbaRR5rI2F7mDrY0xSJUhTsg9yfU1XYQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043