UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TQg94oSzCBo+g87gQuvBd1XbcG4kYQmJpjJ+YeGgwfc=' 
WHERE 
  key_id = '87963ddfbe54dc2d6d2bb11ba97ce2d8dfebf9ce9f207e7a3dba1896746fb7f3' 
  AND (
    token = 'TQg94oSzCBo+g87gQuvBd1XbcG4kYQmJpjJ+YeGgwfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033