UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'naAqX3B96sn/75J0+Ng1XXz50nmJw0tK492XnSztH4Q=' 
WHERE 
  key_id = '1176cb880966cd6b14eafe4a37dce626853303bbfab816dbf62acec4b86caa4f' 
  AND (
    token = 'naAqX3B96sn/75J0+Ng1XXz50nmJw0tK492XnSztH4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030