UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GPGacRyzx2ipmPe34bj+RZddig0oC7CmpYe+ampKtLQ=' 
WHERE 
  key_id = 'd1ed8d4b2300175d1de228538e74cb44501887d2f62b942eb234dd50f41907b2' 
  AND (
    token = 'GPGacRyzx2ipmPe34bj+RZddig0oC7CmpYe+ampKtLQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043