UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nmnXMvbEXhTFuUBstNP4YYGpwYyp9UjXjK89gGQQ2Fo=' 
WHERE 
  key_id = '87bac2b086cf1e8f24cd942001f630ffcf792177cf374e64349a5ef6de5b701f' 
  AND (
    token = 'nmnXMvbEXhTFuUBstNP4YYGpwYyp9UjXjK89gGQQ2Fo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031