UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gU8NQz3sALpmi4Fk42R5jv04I4NaljoK39sxNCmpTWA=' 
WHERE 
  key_id = '2d167e1e1a10b8abbd3234e63e18ef9e801c4005d45ea0fab6274a661c881146' 
  AND (
    token = 'gU8NQz3sALpmi4Fk42R5jv04I4NaljoK39sxNCmpTWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025