UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9pjE5mcwwm6jvUNBiMfVDkBMbDsdsOq3Kh1AJ2D8RBI=' 
WHERE 
  key_id = '3a0bc2a5d5973fee562455f96654c2166238224358a34e40248b69572dc240f4' 
  AND (
    token = '9pjE5mcwwm6jvUNBiMfVDkBMbDsdsOq3Kh1AJ2D8RBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033