UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R2dYjv11SA211FfTEmTP8yYlbyiWtMHhVPG+gBmeE3o=' 
WHERE 
  key_id = 'b2baaeca2f7999cfa19adfafd06ce34646f240e5e9f03c83a185144e985544cf' 
  AND (
    token = 'R2dYjv11SA211FfTEmTP8yYlbyiWtMHhVPG+gBmeE3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026