UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nO34LRlK1y/c7xwamy7s8LMGpft+Odn9r+BSgjXEyiw=' 
WHERE 
  key_id = 'f6fa0852765d64cd6c985a89c3abc33391b9046fd7039c05e2d7dd041c237da3' 
  AND (
    token = 'nO34LRlK1y/c7xwamy7s8LMGpft+Odn9r+BSgjXEyiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034