UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AF+Zz77wadg9msnPs4fvG6YuybWbrAfEV5Yfjwugx/g=' 
WHERE 
  key_id = '0339a916850478c4af48c21d143a12d455ebd23168aa3f144898b036e2e5e3a7' 
  AND (
    token = 'AF+Zz77wadg9msnPs4fvG6YuybWbrAfEV5Yfjwugx/g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038