UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XADRMw0N07TWJ4HIAAVNoRwyj+mM6EzkPDFFqIjgrr4=' 
WHERE 
  key_id = 'fe7ed22cb2297a86fec27da28b61a359acc72b461f69c805d5718bb37dbdcdd7' 
  AND (
    token = 'XADRMw0N07TWJ4HIAAVNoRwyj+mM6EzkPDFFqIjgrr4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047