UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pw2PmgK5FiusAnIoisbWVc+nk1A+yADR2E0cntSjgOk=' 
WHERE 
  key_id = '6d475e7a072d9d7333a7122c1d26c21b71c224282ccfb68ec458b40603beed09' 
  AND (
    token = 'Pw2PmgK5FiusAnIoisbWVc+nk1A+yADR2E0cntSjgOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026