UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a1Bh9MDv9tZFH0tmSCiDyUI/v2vHan9FP078NmBSLAc=' 
WHERE 
  key_id = '3b3857544e2f522a123e4f1997a78bc72847d8ff4a293ec4063dcb4feb4ad20f' 
  AND (
    token = 'a1Bh9MDv9tZFH0tmSCiDyUI/v2vHan9FP078NmBSLAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042